﻿using Heroius.Extension;
using System;
using System.Globalization;
using System.IO;
using System.Windows.Data;

namespace IEPI.BIATranscribe
{
    public class FileNameConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return $"{App.Current.EffectTargetPath}/{value.ToString()}";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {            
            //obsolete path to save filename
            try
            {
                return new FileInfo(value.ToString()).Name;
            }
            catch
            {
                return "无效路径";
            }
        }
    }
}
